<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Admin\BaseController;
use App\Http\Requests\Api\AjaxPacketRequest;
use App\Services\GameTool\RedPacketService;

class RedPacketController extends BaseController
{

    public function __construct(RedPacketService $redPacketService)
    {
        $this->redPacketService = $redPacketService;
    }

    /**
     * 调用红包接口
     */
    public function ajaxPacket(AjaxPacketRequest $request)
    {
        $result = $this->redPacketService->create($request);
        if ($result) {
            return ['code' => 1];
        } else {
            return ['code' => -1, 'msg' => '保存数据库失败'];
        }
    }
}
